package com.open.free.generator.service;

import com.open.free.generator.entity.Columns;
import com.open.free.generator.entity.Source;
import com.open.free.generator.entity.Tables;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * @author Faye.Wang
 * @version 1.0
 * @date 2020/12/28 22:50
 * @Description
 */
public interface ISourceService {
   void insertSource(Source source);

   List<Source> getDataSourceList();

   void delDataSource(Integer id);

   List<Tables> getTables(Source source) throws SQLException;

   Source getSourceById(Integer id);

   Map<String,Object> getSqlResultColumns(Source source,String sql) throws Exception;

   /**
    * 获取数据bean
    * @param source
    * @param table
    * @return
    * @throws Exception
    */
   List<Columns> getTablesBean(Source source, String table) throws Exception;

   /**
    * 根据表结构生成Entity
    * @param source
    * @param table
    * @return
    * @throws Exception
    */
   List<Columns> getTableEntity(Source source,String table) ;

   /**
    * 生成Vo
    * @param source
    * @param table
    * @return
    * @throws Exception
    */
   List<Columns> getTableVo(Source source,String table,List<String> voList,List<Columns> columnsList ) throws Exception;

   /**
    * 获取table 字段信息
    * @param source
    * @param table
    * @return
    */
   Columns getTableInfo(Source source,String table,String cname);
}
